import 'package:equatable/equatable.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_purchased_subscription_renewal_info.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction.dart';

abstract class AppStoreApiNotification {}

class DidChangeRenewalStatusAppStoreApiNotification extends Equatable
    implements AppStoreApiNotification {
  const DidChangeRenewalStatusAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class DidFailToRenewAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const DidFailToRenewAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class DidRenewAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const DidRenewAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class ExpiredAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const ExpiredAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class GracePeriodExpiredAppStoreApiNotification extends Equatable
    implements AppStoreApiNotification {
  const GracePeriodExpiredAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class OfferRedeemedAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const OfferRedeemedAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class PriceIncreaseAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const PriceIncreaseAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class RefundAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const RefundAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}

class SubscribedAppStoreApiNotification extends Equatable implements AppStoreApiNotification {
  const SubscribedAppStoreApiNotification({
    required this.transaction,
    required this.renewalInfo,
  });

  final AppStoreApiTransaction transaction;
  final AppStoreApiPurchasedSubscriptionRenewalInfo renewalInfo;

  @override
  List<Object?> get props {
    return [
      transaction,
      renewalInfo,
    ];
  }
}
